package com.test.mybatis.service;

import com.alibaba.fastjson.JSONObject;
import com.test.mybatis.dao.TestDao;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;

/**
 * @program: spring-cloud-demo
 * @description: mybatis服务类
 * @author: lyr
 * @create: 2018-06-04 10:52
 **/

@Service
@Slf4j
public class MybatisService implements CommandLineRunner {

    @Autowired
    private TestDao testDao;

    @Override
    public void run(String... args) throws Exception {
        List<HashMap> resultMapList = testDao.select();
        log.debug("##################### mybatis服务类 读取数据 #####################");
        log.debug(JSONObject.toJSONString(resultMapList));
    }
}
